{{ define "body" }}

{{ if HasPrefix .ListType `category` }}
{{ if ne .Category.TopicTitle `` }}
<section class="container">
  <div class="panel bg-gray">
    <div class="panel-header">
      <div class="panel-title">#{{ .Category.TopicTitle }}</div>
    </div>
    <div class="panel-body">
      <article>
        {{ .Category.Topic }}
      </article>
    </div>
  </div>
</section>
{{ end }}
{{ end }}

<section class="text-gray-600 body-font overflow-hidden">
  <div class="container px-5 py-24 mx-auto">
    <div class="-my-8 divide-y-2 divide-gray-100">
      {{ range $article := .Articles }}
      <div class="py-8 flex flex-wrap md:flex-nowrap">
        <div class="md:w-64 md:mb-0 mb-6 flex-shrink-0 flex flex-col">
          <span class="font-semibold title-font text-gray-700">{{ if eq $article.CategoryID `` }} {{`未分类`}} {{ else }}
            {{ GetCategoryByDategoryID $article.CategoryID }} {{ end }}</span>
          <span class="mt-1 text-gray-500 text-sm">最后编辑于：{{ .UpdateFromNow }}</span>
        </div>
        <div class="md:flex-grow">
          <a class="text-2xl font-medium text-gray-900 title-font mb-4" href="/{{ $article.Filename }}">{{
            $article.Title }}</a>
          <p class="leading-relaxed">{{ $article.Summary }}</p>
          <a class="text-indigo-500 inline-flex items-center mt-4" href="/{{ $article.Filename }}">更多
            <svg class="w-4 h-4 ml-2" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2" fill="none"
              stroke-linecap="round" stroke-linejoin="round">
              <path d="M5 12h14"></path>
              <path d="M12 5l7 7-7 7"></path>
            </svg>
          </a>
        </div>
      </div>
      {{ end }}
    </div>
  </div>
</section>

<div class="flex justify-center">
  <nav aria-label="Page navigation example">
    <ul class="flex list-style-none">
      <li class="page-item {{ if eq $.CurPage `0` }} {{ `disabled` }}} {{ end }}"><a
          class="page-link relative block py-1.5 px-3 rounded border-0 bg-transparent outline-none transition-all duration-300 rounded text-gray-800 hover:text-gray-800 hover:bg-gray-200 focus:shadow-none"
          href="{{ .PrevPage }}" tabindex="-1">上一页</a></li>
      {{ range $page := .Pages }}
      <li class="page-item">
        {{ if IsDigit $page }}
        <a class="page-link relative block py-1.5 px-3 rounded border-0 {{ if eq $page $.CurPage }} {{ `bg-blue-600` }} {{ end }} bg-transparent outline-none transition-all duration-300 rounded text-gray-800 hover:text-gray-800 hover:bg-gray-200 focus:shadow-none"
          href="{{ printf `/%s/%s`  $.ListType $page }}">{{ $page }}</a>
        {{ else }}
        <span>...</span>
        {{ end}}
      </li>
      {{ end}}
      <li class="page-item"><a
          class="page-link relative block py-1.5 px-3 rounded border-0 bg-transparent outline-none transition-all duration-300 rounded text-gray-800 hover:text-gray-800 hover:bg-gray-200 focus:shadow-none"
          href="{{ .NextPage }}">下一页</a></li>
    </ul>
  </nav>
</div>

{{ end }}